//
//  TradeOrderUserCenterTwoCell.swift
//  Exchange
//
//  Created by rui on 2018/5/22.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class TradeOrderUserCenterTwoCell: UITableViewCell {

    @IBOutlet weak var payType: UIImageView!
    @IBOutlet weak var buyDirection: UILabel!
    @IBOutlet weak var exchangeStatus: UILabel!
    @IBOutlet weak var price: UILabel!
    @IBOutlet weak var exchangePriceTitle: UILabel!
    @IBOutlet weak var exchangeTimeTitle: UILabel!
    @IBOutlet weak var exchangeTime: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectionStyle = .none
        self.exchangePriceTitle.text = kText("交易金额")
        self.exchangeTimeTitle.text = kText("交易时间")
        let view = UIView(frame: self.bounds)
        view.autoresizingMask = [.flexibleWidth,.flexibleHeight]
        self.selectedBackgroundView = UIView(frame: self.bounds)
        self.selectedBackgroundView?.themeBackground = ThemeManager.ThemeColorKeys.selectTabColor
    }

    func configer(model: TradeOrderListModel) {
        if model.payMethod == 2 {
            self.payType.image = #imageLiteral(resourceName: "unionPay")
        }else {
            self.payType.image = #imageLiteral(resourceName: "aliPay")
        }
        let currency = model.currency
        self.price.text = String(format: "%0.2f%@", model.amount ?? 0,currency ?? "")
        self.exchangeTime.text = model.createdAt
  
        if model.type == 0 {
            self.buyDirection.text = kText("我出售的")
        }else {
            self.buyDirection.text = kText("我购买的")
        }
        if model.status == 0 {
            self.exchangeStatus.text = kText("进行中")
        }else {
            self.exchangeStatus.text = kText("已完成")
        }
    }
}
